{% extends "store/base.html" %}

{% block title %}
    {{ store_name }}-商品列表页面
{% endblock %}

{% block label %}
    <a class="btn btn-warning" href="/Store/add_good/">添加商品</a>
{% endblock %}

{% block content %}
    <table class="table-bordered table">
        <thead>
            <tr align="center">
                <th>商品名称</th>
                <th>商品价格</th>
                <th>商品数量</th>
                <th>出厂日期</th>
                <th>保质期</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
{#            {% for goods in goods_list %}#}
            {% for goods in page %}
            <tr align="center">
                <td>
                    <a href="/Store/goods/{{ goods.id }}">{{ goods.goods_name }}</a>
                </td>
                <td>
                    <input type="text" value="{{ goods.goods_price }}" style="text-align: center">
                </td>
                <td>{{ goods.goods_number }}</td>
                <td>{{ goods.goods_date }}</td>
                <td>{{ goods.goods_safeDate }}</td>
                <td>
                    {% ifequal state 'up' %}
                    <a class="btn btn-danger" href="/Store/set_goods/down/?id={{ goods.id }}">下架</a>
                    {% else %}
                    <a class="btn btn-danger" href="/Store/set_goods/up/?id={{ goods.id }}">上架</a>
                    {% endifequal %}
                    <a class="btn btn-primary" href="/Store/set_goods/delete/?id={{ goods.id }}">销毁</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
    <div class="dataTables_paginate paging_simple_numbers">
        <ul class="pagination">
            {% for p in page_range %}
            <li class="paginate_button page-item ">
                <a class="page-link" href="?keywords={{ keywords }}&page_num={{ p }}">{{ p }}</a>
            </li>
            {% endfor %}
        </ul>
    </div>
{% endblock %}